package org.studiox.graph.persistence.spring.jdbc.rowmapper;

import org.springframework.jdbc.core.RowMapper;
import org.studiox.graph.persistence.model.GraphVertexDO;

import java.sql.ResultSet;
import java.sql.SQLException;

public class GraphVertexDOMapper implements RowMapper<GraphVertexDO> {

  @Override
  public GraphVertexDO mapRow(ResultSet rs, int rowNum) throws SQLException {
    GraphVertexDO graphVertexDO = new GraphVertexDO();
    graphVertexDO.setId(rs.getLong("id"));
    graphVertexDO.setUniq(rs.getString("uniq"));
    graphVertexDO.setType(rs.getString("type"));
    graphVertexDO.setOwner(rs.getString("owner"));
    graphVertexDO.setJanusVertexId(rs.getLong("janus_vertex_id"));
    graphVertexDO.setNeo4jVertexId(rs.getLong("neo4j_vertex_id"));
    graphVertexDO.setNebulaVertexId(rs.getLong("nebula_vertex_id"));
    graphVertexDO.setTemp(rs.getBoolean("temp"));
    graphVertexDO.setDeleted(rs.getBoolean("deleted"));
    graphVertexDO.setCreateTime(rs.getTimestamp("create_time"));
    graphVertexDO.setUpdateTime(rs.getTimestamp("update_time"));
    return graphVertexDO;
  }
}
